<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<link href="../style/css/manual-zip.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-zip-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
<title>mod_usertrack － Apache 2.2 中文手册 [金步国]</title>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head>
<body><div id="page-header">
<p class="menu"><a href="index.html">模块索引</a> | <a href="directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p><p class="apache">Apache HTTP Server 版本2.2</p><img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="index.html"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
<div id="path"><a href="https://www.apache.org/">Apache</a> &gt; <a href="https://httpd.apache.org/">HTTP Server</a> &gt; <a href="https://httpd.apache.org/docs/">文档</a> &gt; <a href="../index.html">版本2.2</a> &gt; <a href="index.html">模块</a></div>

<div id="translation-info">　　 <a href="../translator_announcement.html#thanks">致谢</a> | 本篇译者：&lt;<a href="../translator_announcement.html#join">虚位以待</a>&gt; | 本篇译稿完成时间：?年?月?日</div>
<div id="page-content"><div id="preamble"><h1>Apache模块 mod_usertrack</h1>

<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="module">
<tr><th><a href="module-dict.html#Description">说明</a></th><td>使用Session跟踪用户(会发送很多Cookie)，以记录用户的点击流</td></tr>
<tr><th><a href="module-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="module-dict.html#ModuleIdentifier">模块名</a></th><td>usertrack_module</td></tr>
<tr><th><a href="module-dict.html#SourceFile">源文件</a></th><td>mod_usertrack.c</td></tr>
</table>
<h3>概述</h3>

    <p>Previous releases of Apache have included a module which
    generates a 'clickstream' log of user activity on a site using
    cookies. This was called the "cookies" module, mod_cookies. In
    Apache 1.2 and later this module has been renamed the "user
    tracking" module, mod_usertrack. This module has been
    simplified and new directives added.</p>
</div>
<div class="top"><a href="mod_usertrack.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="logging" id="logging">Logging</a></h2>


    <p>Previously, the cookies module (now the user tracking
    module) did its own logging, using the <code class="directive">CookieLog</code>
    directive. In this release, this module does no logging at all.
    Instead, a configurable log format file should be used to log
    user click-streams. This is possible because the logging module
    now allows multiple log files. The cookie itself is logged by
    using the text <code>%{cookie}n</code> in the log file format. For
    example:</p>
<div class="example"><p><code>
CustomLog logs/clickstream "%{cookie}n %r %t"
</code></p></div>

    <p>For backward compatibility the configurable log module
    implements the old <code class="directive"><a href="mod_log_config.html#cookielog">CookieLog</a></code> directive, but this
    should be upgraded to the above <code class="directive"><a href="mod_log_config.html#customlog">CustomLog</a></code> directive. </p>
</div><div class="top"><a href="mod_usertrack.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="cookiedate" id="cookiedate">2-digit or 4-digit dates for cookies?</a></h2>


    <p>(the following is from message
    &lt;022701bda43d$9d32bbb0$1201a8c0@christian.office.sane.com&gt;
    in the new-httpd archives) </p>
<pre>
From: "Christian Allen" &lt;christian@sane.com&gt;
Subject: Re: Apache Y2K bug in mod_usertrack.c
Date: Tue, 30 Jun 1998 11:41:56 -0400

Did some work with cookies and dug up some info that might be useful.

True, Netscape claims that the correct format NOW is four digit dates, and
four digit dates do in fact work... for Netscape 4.x (Communicator), that
is.  However, 3.x and below do NOT accept them.  It seems that Netscape
originally had a 2-digit standard, and then with all of the Y2K hype and
probably a few complaints, changed to a four digit date for Communicator.
Fortunately, 4.x also understands the 2-digit format, and so the best way to
ensure that your expiration date is legible to the client's browser is to
use 2-digit dates.

However, this does not limit expiration dates to the year 2000; if you use
an expiration year of "13", for example, it is interpreted as 2013, NOT
1913!  In fact, you can use an expiration year of up to "37", and it will be
understood as "2037" by both MSIE and Netscape versions 3.x and up (not sure
about versions previous to those).  Not sure why Netscape used that
particular year as its cut-off point, but my guess is that it was in respect
to UNIX's 2038 problem.  Netscape/MSIE 4.x seem to be able to understand
2-digit years beyond that, at least until "50" for sure (I think they
understand up until about "70", but not for sure).

Summary:  Mozilla 3.x and up understands two digit dates up until "37"
(2037).  Mozilla 4.x understands up until at least "50" (2050) in 2-digit
form, but also understands 4-digit years, which can probably reach up until
9999.  Your best bet for sending a long-life cookie is to send it for some
time late in the year "37".
</pre>

</div>
<div class="top"><a href="mod_usertrack.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CookieDomain" id="CookieDomain">CookieDomain</a> <a name="cookiedomain" id="cookiedomain">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>The domain to which the tracking cookie applies</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CookieDomain <em>domain</em></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>FileInfo</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_usertrack</td></tr>
</table>

    <p>This directive controls the setting of the domain to which
    the tracking cookie applies. If not present, no domain is
    included in the cookie header field.</p>

    <p>The domain string <strong>must</strong> begin with a dot, and
    <strong>must</strong> include at least one embedded dot. That is,
    ".foo.com" is legal, but "foo.bar.com" and ".com" are not.</p>

</div>
<div class="top"><a href="mod_usertrack.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CookieExpires" id="CookieExpires">CookieExpires</a> <a name="cookieexpires" id="cookieexpires">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Expiry time for the tracking cookie</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CookieExpires <em>expiry-period</em></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>FileInfo</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_usertrack</td></tr>
</table>
    <p>When used, this directive sets an expiry time on the cookie
    generated by the usertrack module. The <em>expiry-period</em>
    can be given either as a number of seconds, or in the format
    such as "2 weeks 3 days 7 hours". Valid denominations are:
    years, months, weeks, days, hours, minutes and seconds. If the expiry
    time is in any format other than one number indicating the
    number of seconds, it must be enclosed by double quotes.</p>

    <p>If this directive is not used, cookies last only for the
    current browser session.</p>

</div>
<div class="top"><a href="mod_usertrack.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CookieName" id="CookieName">CookieName</a> <a name="cookiename" id="cookiename">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Name of the tracking cookie</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CookieName <em>token</em></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CookieName Apache</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>FileInfo</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_usertrack</td></tr>
</table>
    <p>This directive allows you to change the name of the cookie
    this module uses for its tracking purposes. By default the
    cookie is named "<code>Apache</code>".</p>

    <p>You must specify a valid cookie name; results are
    unpredictable if you use a name containing unusual characters.
    Valid characters include A-Z, a-z, 0-9, "_", and "-".</p>

</div>
<div class="top"><a href="mod_usertrack.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CookieStyle" id="CookieStyle">CookieStyle</a> <a name="cookiestyle" id="cookiestyle">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Format of the cookie header field</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CookieStyle
    <em>Netscape|Cookie|Cookie2|RFC2109|RFC2965</em></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CookieStyle Netscape</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>FileInfo</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_usertrack</td></tr>
</table>
    <p>This directive controls the format of the cookie header
    field. The three formats allowed are:</p>

    <ul>
      <li><strong>Netscape</strong>, which is the original but now deprecated
      syntax. This is the default, and the syntax Apache has
      historically used.</li>

      <li><strong>Cookie</strong>或<strong>RFC2109</strong>, which is the syntax that
      superseded the Netscape syntax.</li>

      <li><strong>Cookie2</strong>或<strong>RFC2965</strong>, which is the most
      current cookie syntax.</li>
    </ul>

    <p>Not all clients can understand all of these formats. but you
    should use the newest one that is generally acceptable to your
    users' browsers.</p>

</div>
<div class="top"><a href="mod_usertrack.html#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CookieTracking" id="CookieTracking">CookieTracking</a> <a name="cookietracking" id="cookietracking">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Enables tracking cookie</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CookieTracking on|off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>CookieTracking off</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>FileInfo</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_usertrack</td></tr>
</table>
    <p>When the user track module is compiled in, and
    "CookieTracking on" is set, Apache will start sending a
    user-tracking cookie for all new requests. This directive can
    be used to turn this behavior on or off on a per-server or
    per-directory basis. By default, compiling mod_usertrack will
    not activate cookies. </p>


</div>
</div>
<div id="footer">
<p class="apache">本文允许自由的转载、引用、再分发，但必须保留译者署名并注明出处；详见：<a href="../translator_announcement.html#announcement">版权声明</a>。</p>
<p class="menu"><a href="index.html">模块索引</a> | <a href="directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p></div>
</body></html>
